package com.cn.gateway.redis;

/**
 * redis key
 *
 * @author cheney
 * @date 2019/4/16
 */
public enum RedisConstant {

    // Master选举
    MASTER("MASTER"),

    // 机器ID
    WORK_ID("WORK_ID"),

    // 缓存用户信息
    USER_INFO("USER_INFO_%s"),

    // 缓存角色权限和菜单信息
    MENU_INFO("ALL_MENU_INFO");

    public final static String PRE = "AUTH:";

    private String key;

    RedisConstant(String key) {
        this.key = key;
    }

    public String getKey() {
        return PRE + key;
    }

    public String getKey(String param) {
        return String.format(this.getKey(), param);
    }
}
